<?php
$db = Db::getInstance();
try{
	if($_SERVER['REQUEST_METHOD'] == 'POST'){
		if(!Account::register($_POST['email'], $_POST['password'], $_POST['phone'], $_POST['name'], $_POST['address'])){
			throw new Exception('Register failed');
		}
		echo "Register success<br />Please Check email for activate your account";
	}
	else {
		View::display('register');
	}
}
catch(Exception $ex){
	Log::error($ex->getMessage());
	View::display('error', $ex->getMessage());
}